package com.settlement.system.mapper;

import com.settlement.system.common.exception.ServiceException;
import com.settlement.system.model.entity.common.SinglePage;
import com.settlement.system.model.entity.common.TblReceiveRefundAccount;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 收退款-账号 Mapper 接口
 *
 * @author Ximi
 * @since 2020-07-07
 */
public interface TblReceiveRefundAccountMapper extends BaseMapper {

    /**
     * 根据NC虚拟账号,获取账号信息
     *
     * @param ncVirtualAccount NC_虚拟账户
     * @param checkAccountBookNo 核算账簿编码
     * @param ncShopNo nc店铺编码
     * @return
     */
    public List<TblReceiveRefundAccount> getAccount(@Param("ncVirtualAccount") String ncVirtualAccount,
                                                    @Param("checkAccountBookNo") String checkAccountBookNo,
                                                    @Param("ncShopNo") String ncShopNo);

    /**
     * getNcVirtualAccountCount
     * @param params
     * @return
     * @throws Exception
     */
    int getNcVirtualAccountCount(@Param("params") Map<String, Object> params) throws Exception;

    /**
     * getNcVirtualAccountNameCount
     * @param params
     * @return
     * @throws Exception
     */
    int getNcVirtualAccountNameCount(@Param("params") Map<String, Object> params) throws Exception;

    /**
     * getNcVirtualAccountList
     * @param page
     * @param params
     * @param orderByField
     * @param orderBy
     * @return
     */
    List<TblReceiveRefundAccount> getNcVirtualAccountList(@Param("page") SinglePage page, @Param("params") Map<String,Object> params,
                                                          @Param("orderByField") String orderByField, @Param("orderBy") String orderBy);

    /**
     * getNcVirtualAccountNameList
     * @param page
     * @param params
     * @param orderByField
     * @param orderBy
     * @return
     */
    List<TblReceiveRefundAccount> getNcVirtualAccountNameList(@Param("page") SinglePage page, @Param("params") Map<String,Object> params,
                                                          @Param("orderByField") String orderByField, @Param("orderBy") String orderBy);


    /**
     * 根据NC虚拟账号获取账号表数据
     *
     * @param ncVirtualAccount 虚拟账号
     * @return
     * @throws ServiceException
     */
    public List<TblReceiveRefundAccount> getByNcVirtualAccount(@Param("ncVirtualAccount") String ncVirtualAccount) throws ServiceException;

    /**
     * getChannelNameByNcVirtualAccountName
     * @param ncVirtualAccountName
     * @return
     * @throws ServiceException
     */
    public String getChannelNameByNcVirtualAccountName(@Param("ncVirtualAccountName") String ncVirtualAccountName) throws ServiceException;



    /**
     * 根据NC虚拟账号获取账号表数据
     *
     * @param ncEnterAccountBody 入账主体
     * @return
     * @throws ServiceException
     */
    public List<TblReceiveRefundAccount> getByNcEnterAccountBody(@Param("ncEnterAccountBody") String ncEnterAccountBody) throws ServiceException;

    /**
     * 通过登陆账号获取线下打款账号
     *
     * @param loginAccount
     * @return
     */
    TblReceiveRefundAccount getOrByLoginAccount(@Param("loginAccount") String loginAccount) ;

    /**
     * 通过店铺账号获取线下打款账号
     *
     * @param shopAccount
     * @return
     */
    TblReceiveRefundAccount getOrByShopAccount(@Param("shopAccount") String shopAccount) ;

    TblReceiveRefundAccount selectExistAccount(@Param("params") TblReceiveRefundAccount account);
}

